<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增用户套餐关联')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-userlevelpackage-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">用户：</label>
                <div class="col-sm-8">
                    <input autocomplete="off" id="userName" name="userName" class="form-control" type="text" onclick="chooseUser();">
                    <input id="userId" name="userId" class="form-control" type="hidden">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">套餐：</label>
                <div class="col-sm-8">
                    <input id="packageId" name="packageId" class="form-control" type="hidden">
                    <input autocomplete="off" id="packageName" name="packageName" class="form-control" type="text" onclick="choosePackage();">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">包含次数：</label>
                <div class="col-sm-8">
                    <input id="packageTimes" name="packageTimes" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "lm/userlevelpackage"
        $("#form-userlevelpackage-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-userlevelpackage-add').serialize());
            }
        }
        
        function chooseUser() {
            $.modal.open("选择用户", ctx+"lm/userlevelpackage/chooseUser/");
        }
        function choosePackage() {
            $.modal.open("选择套餐", ctx+"lm/userlevelpackage/choosePackage/");
        }
    </script>
</body>
</html>